import java.io.File;
import java.io.FileFilter;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.RandomAccessFile;

public class E3 {

  public static void searchFileSystem(File file) {
    if (file.isDirectory()) {
      File[] list = file.listFiles(new FileFilter() {
        @Override
        public boolean accept(File file) {
          if (file.isDirectory())
            return true;
          return (file.getName().endsWith("bmp"));
        }
      });
      if (null == list)
        return;
      for (File f : list) {
        searchFileSystem(f);
      }
    } else {
      // size should be more than 26 bytes
      if (file.length() > 26) {
        try {
          RandomAccessFile raf = new RandomAccessFile(file, "r");
          try {
            short header = raf.readShort();
            byte[] dontCareAbout = new byte[16];
            raf.read(dontCareAbout);
            int width = raf.readInt();
            int height = raf.readInt();
            System.out.format("%dx%d %s%n",width,height,file.getName());
          } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } finally {
            try {
              raf.close();
            } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }

        } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
    }
  }

  /**
   * @param args
   */
  public static void main(String[] args) {
    File root = new File("C:\\WINDOWS");
    searchFileSystem(root);
  }

}
